/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.zx.ObjectClasses;

import java.util.ArrayList;
import java.util.Comparator;

/**
 *
 * @author VcLi
 */
public class Station implements Comparable<Station> {
    private String name;
    //determine whether the station is an interchange in the readfile method
    private boolean interchange;
    private ArrayList<TrainService> operatingTsInStn = new ArrayList<TrainService>();

    public boolean isInterchange() {
        return interchange;
    }

    public void setInterchange(boolean interchange) {
        this.interchange = interchange;
    }

    public ArrayList<TrainService> getOperatingTsInStn() {
        return operatingTsInStn;
    }

    public void setOperatingTsInStn(ArrayList<TrainService> operatingTsInStn) {
        this.operatingTsInStn = operatingTsInStn;
    }
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public static Comparator<Station> stationNameComparator 
                          = new Comparator<Station>() {
 
	    public int compare(Station station1, Station station2) {
 
	      String stationName1 = station1.getName().toUpperCase();
	      String stationName2 = station2.getName().toUpperCase();
 
	      //ascending order
	      return stationName1.compareTo(stationName2);
 
	      //descending order
	      //return stationName2.compareTo(stationName1);
	    }
	};

    @Override
    public int compareTo(Station stn) {
       return name.compareTo(stn.getName());
    }
    
}
